package com.stu.commons;

import lombok.Data;

/**
 * 服务端响应数据的统一结果 封装
 */
@Data
public class ServerResponse {

    private int resultcode;
    private String reason;
    private Object data;

    public ServerResponse(int resultcode, String reason, Object data) {
        this.resultcode = resultcode;
        this.reason = reason;
        this.data = data;
    }

    public ServerResponse(){}

    public static ServerResponse success(String reason,Object data){
        return new ServerResponse(200,reason,data);
    }

    public static ServerResponse fail(String reason,Object data){
        return new ServerResponse(201,reason,data);
    }

}
